package com.vgemv.jsutilitysdk.Reminder;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.vgemv.jsutilitysdk.R;


public class JsMessageReminderIl extends LinearLayout {

    public TextView mTv;
    public ImageView mIv;
    private Context mContext;

    public JsMessageReminderIl(Context context) {
        this(context, null);
    }

    public JsMessageReminderIl(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public JsMessageReminderIl(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.mContext = context;
        init();
    }

    private void init() {
        //从xml中加载其根元素,然后作为本身的一个子视图.null
        //设置root后,返回的就是这个root,否则,返回的是xml中的根节点. 第三个为false,才能获取到xml中的layoutParam.
        View view = LayoutInflater.from(mContext).inflate(R.layout.gaj_message_reminder_il, this, false);
        mTv = view.findViewById(R.id.tv);
        mIv = view.findViewById(R.id.iv);

        //加载出来的时是没有layoutparams的,需要手动设定
        ViewGroup.LayoutParams lp = view.getLayoutParams();
        this.addView(view);
        this.setLayoutParams(lp);
    }


}
